
// 可以接受图片
const multiparty = require('multiparty')

// 上传图片
const upload = (req, res) => {
    let form = new multiparty.Form()
    form.uploadDir = 'upload'
    form.parse(req, (err, formData, imgData) => {
        // 将上传的图片传递给前端
        // console.log(imgData.file[0].path);
        res.send({
            message: '上传成功',
            filename: imgData.file[0].path,
            success: true
        })
    })
}
module.exports = {
    upload
}